package com.practice;

import java.util.Random;
import java.util.Scanner;

public class demo10 {
    public static void main(String[] args) {
        //生成随机数
        Random r = new Random();
        int guess = r.nextInt(1, 101);
        //生成扫描器，录入整数
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请输入您要猜的数字");
            int num = sc.nextInt();
            if (num > guess) {
                System.out.println("大了");
                continue;
            } else if (num < guess) {
                System.out.println("小了");
                continue;
            } else {
                System.out.println("中了");
                break;
            }
        }
    }
}
